<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <Canvas id="c1" width="600" height="400">
        当前浏览器不支持canvas，请下载最新的浏览器
    </Canvas>

    <video src="./static/meixi.mp4" hidden></video>

    <button id="btn">播放/暂停</button>

    <script>
        /** @type {HTMLCanvasElement}**/
        var c1 = document.getElementById("c1");
        if(!c1.getContext){
            console.log('当前浏览器不支持canvas，请下载最新浏览器')
        }
        var ctx = c1.getContext('2d');

        // var video = document.createElement('video');
        // video.src = './static/meixi.mp4';
        var video = document.querySelector('video');

        let btn = document.querySelector('#btn');
        btn.onclick=function(){
            video.play();
            render();
            
        }

        let img = new Image();
        img.src = './static/head.png';


        function render(){
            ctx.drawImage(video,0,0,600,400);
            ctx.drawImage(img,50,50,60,60);
            requestAnimationFrame(render);
        }
    </script>
</body>
</html>